import { lazy } from "react";
import * as Type from "../utils/index";

export const mainRouter: Type.RouterList = [
  {
    path: "/index/home",
    element: lazy(() => import("../views/index/Home")),
    key: 21,
  },
  {
    path: "/index/trainNumber",
    key: 22,
    element: lazy(() => import("../views/index/TrainNumber")),
  },

  {
    path: "/index/order",
    key: 23,
    element: lazy(() => import("../views/index/Order")),
  },
  // 新增
  {
    path: "/index/trainNumber/add",
    key: 24,
    element: lazy(() => import("../views/index/order/NewTrainNumber")),
  },
  {
    path: "/index/station",
    key: 25,
    element: lazy(() => import("../views/index/station")),
  },
  {
    path: "/index/line",
    key: 26,
    element: lazy(() => import("../views/index/Line")),
  },
  {
    path: "/index/ticket",
    key: 26,
    element: lazy(() => import("../views/index/Ticketmanner")),
  },
];

const routes: Type.RouterList = [
  {
    path: "/",
    to: "/index/home",
    key: 1,
  },
  {
    path: "/index",
    element: lazy(() => import("../views/index")),
    children: mainRouter,
    key: 2,
  },
  {
    path: "*",
    element: lazy(() => import("../views/Error")),
    key: 3,
  },
  {
    path: "/Login",
    element: lazy(() => import("../views/Login")),
    key: 4,
  },
];

export default routes;
